package com.kingdee.eas.custom.hr.attendance.client;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.eas.basedata.person.PersonInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.common.PersonUtil;
import com.kingdee.eas.custom.hr.attendance.WorkingTimeZoneFlucationEntryInfo;
import com.kingdee.eas.hr.base.client.HRBillEditUIBiz;

public class WorkingTimeZoneFlucationEditUIBiz extends HRBillEditUIBiz {

	@Override
	protected IObjectValue createNewDetailData(PersonInfo person) {
		WorkingTimeZoneFlucationEntryInfo info = new WorkingTimeZoneFlucationEntryInfo();

		info.setPerson(person);

		PersonInfo p = null;
		try {
			p = PersonUtil.getPersonInfo(new ObjectUuidPK(person.getId()),
					"workGroup", "adminOrgBase.*", "attendanceCode.*",
					"workforceManagement.*");
			if (p.getAdminOrgBase() != null) {
				info.setAdminOrgBase(p.getAdminOrgBase().getName());
			}

			if (p.getWorkforceManagement() != null) {
				info.setWorkforceManagement(p.getWorkforceManagement());
			}

			if(p.getAttendanceCode()!=null){
				info.setAttendanceCode(p.getAttendanceCode().getName());
			}
			info.setGroup(p.getWorkGroup());
		} catch (EASBizException e) {
			e.printStackTrace();
		} catch (BOSException e) {
			e.printStackTrace();
		}

		return info;
	}

	@Override
	protected boolean isAddPersonByF7() {
		return true;
	}

}
